using System.Windows.Media.Media3D;

namespace Brjnk.CoordinateSystem2D.Layers
{
    /// <summary>
    /// </summary>
    internal class GraphPointInternal
    {
        public GraphPointInternal(GraphPoint p, ViewInfoBase view, GraphDataInfo dataInfo)
        {
            Original = p;
            if (view == null) return;
            Transform(view, dataInfo);
        }

        public void Transform(ViewInfoBase view, GraphDataInfo dataInfo)
        {
            this.Transformed = TransformPoint(Original, view, dataInfo);
        }

        private Point3D TransformPoint(GraphPoint point, ViewInfoBase view, GraphDataInfo dataInfo)
        {
            var transformed = view.Transform(point.AsPoint());
            return new Point3D(transformed.X, transformed.Y, Graph.GetRelativeZ(point.Pos.Z, dataInfo));
        }

        public GraphPoint Original { get; set; }

        public Point3D Transformed { get; set; }
    }
}